<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="box">我是boxdiv</div>
    <script>
      setTimeout(() => {
        console.log(333);
      });

      console.log(111);

      // 插入一个微任务
      let box = document.querySelector(".box");
      let o = new MutationObserver(function () {
        console.log("属性改变了");
      });
      
      o.observe(box, {
        attributes: true,
      });

      box.setAttribute("myattr", "val");
      console.log(222);
    </script>
  </body>
</html>
